package com.lb.trac.web.velocity;

import java.io.InputStream;

import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.runtime.resource.loader.ResourceLoader;
import org.apache.velocity.tools.view.servlet.ServletUtils;

import com.lb.trac.util.TracSetupUtil;

public class VelocityWebappResourceLoader extends ResourceLoader{

	@Override
	public long getLastModified(Resource arg0) {
		// TODO Auto-generated method stub
		return arg0.getLastModified();
	}

	@Override
	public InputStream getResourceStream(String arg0)
			throws ResourceNotFoundException {
		InputStream in = TracSetupUtil.SERVLET_CONTEXT.getResourceAsStream("WEB-INF/velocity/"+arg0);
		return in;
	}

	@Override
	public void init(ExtendedProperties arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean isSourceModified(Resource arg0) {
		// TODO Auto-generated method stub
		return arg0.isSourceModified();
	}

}
